#pragma once

#include <windows.h>
#pragma comment (lib, "winmm.lib")
#include <vector>
#include <string>
using namespace std;

class CSavedInfo
{
private:
	LARGE_INTEGER m_Freq;

	struct sCodeProfileData
	{
	private:
		string m_szName;
		LARGE_INTEGER m_StartTime;
		vector<double> m_vAllTimes;
		int m_nTotalTimesCalled;

	public:
		void AddTime(double Elapsed) {m_vAllTimes.push_back(Elapsed);}

		string GetName() {return m_szName;}
		LARGE_INTEGER GetStart() {return m_StartTime;}
		int GetTotalTimes() {return m_nTotalTimesCalled;}
		vector<double> GetAll() {return m_vAllTimes;}

		void SetName(string szName) {m_szName = szName;}
		void SetStart(LARGE_INTEGER Start) {m_StartTime = Start;}
		void SetTotalTimes(int nTotal) {m_nTotalTimesCalled = nTotal;}
	};


	vector<sCodeProfileData> m_vProfilerData;



	static CSavedInfo* m_nInstance;

	CSavedInfo(void);
	~CSavedInfo(void);
	CSavedInfo(CSavedInfo& SavedInfo);
	CSavedInfo& operator=(CSavedInfo& SavedInfo);

public:
	//////////////////////////////////////////////////////
	//
	//	Functions for CodeProfiler stuff
	//////////////////////////////////////////////////////
	void StartTime(string szName, LARGE_INTEGER StartTime);
	void StopTime(string szName, LARGE_INTEGER StopTime);
	LARGE_INTEGER GetFreq() {return m_Freq;}
	void SetFreq(LARGE_INTEGER Freq) {m_Freq = Freq;}
	void SaveProfilerData();

	///////////////////////////////////////////////////////


	static CSavedInfo* GetInstance();


};